﻿<%@ Page Title="Estados" Language="C#" MasterPageFile="~/Site.Master"
    AutoEventWireup="true" CodeBehind="CadastroEstado.aspx.cs" Inherits="AcadPosApp.Cadastros.CadastroEstado" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    
    <style type="text/css">
        .style1
        {
            width: 137px;
        }
        .style2
        {
            width: 108px;
        }
        .style4
        {
            width: 119px;
        }
    </style>
    
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <asp:Panel ID="pnlConsulta" runat="server" GroupingText="Consulta de Estados">
        <table class="form-inline">
            <tr>
                <td class="style4">
                    <asp:Label ID="Label1" runat="server" Text="Descrição"></asp:Label>
                    <br />
                    <asp:TextBox ID="TxtPesquisa" 
                        pattern="[çÇùÙúÚôÔõÕòÒóÓìÌíÍêÊèÈéÉáÁàÀãÃâÂaA-zZ\s]+$" runat="server" 
                        Width="400px" MaxLength="50"></asp:TextBox>
                </td>
                <td class="style1">
                    <br />
                    &nbsp;&nbsp;
                    <asp:Button ID="btnConsultar" runat="server" Text="Consultar" 
                        OnClick="btnConsultar_Click" Width="100px" />
                </td>
            </tr>
        </table>
        <br />
        <asp:GridView ID="gvwPesquisa" runat="server" AutoGenerateColumns="False" CssClass="mGrid"
            DataKeyNames="ID_ESTADO" EmptyDataText="Dados não localizados..." GridLines="Vertical"
            OnRowCommand="gvwPesquisa_RowCommand" 
            OnRowCreated="gvwPesquisa_RowCreated" OnRowDataBound="gvwPesquisa_RowDataBound"
            Width="36%" AllowPaging="True" 
            onpageindexchanging="gvwPesquisa_PageIndexChanging">
            <AlternatingRowStyle BackColor="#D3D3D3" />
            <Columns>
                <asp:TemplateField HeaderText="Editar" ShowHeader="False">
                    <ItemTemplate>
                        <abbr title="Editar Estado!">
                            <asp:ImageButton ID="ImgAlterar" runat="server" formnovalidate="formnovalidate" CausesValidation="false" CommandName="Alterar"
                                ImageUrl="~/Imagens/edit.png" Text="Alterar" Width="20px" />
                        </abbr>
                    </ItemTemplate>
                    <HeaderStyle HorizontalAlign="Center" Width="1%" />
                    <ItemStyle HorizontalAlign="Center" Width="1%" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Excluir" ShowHeader="False">
                    <ItemTemplate>
                        <abbr title="Excluir Estado!">
                            <asp:ImageButton ID="ImgExcluir" runat="server" CausesValidation="false" CommandName="Excluir"
                                ImageUrl="~/Imagens/delete.png" formnovalidate="formnovalidate" OnClientClick="return ShowConfirm('Tem certeza que deseja excluir?', this.ID);"
                                Text="Excluir" Width="20px" />
                        </abbr>
                    </ItemTemplate>
                    <HeaderStyle HorizontalAlign="Center" Width="1%" />
                    <ItemStyle HorizontalAlign="Center" Width="1%" />
                </asp:TemplateField>
                <asp:BoundField DataField="ESTADO" HeaderText="Estado">
                    <ItemStyle HorizontalAlign="Center" Width="80%" />
                </asp:BoundField>
                <asp:TemplateField HeaderText="Status">
                    <ItemTemplate>
                        <asp:Image ID="imgStatus" runat="server" Height="25px" Width="25px" />
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="Center" />
                </asp:TemplateField>
                <asp:BoundField DataField="STATUS" HeaderText="Status">
                    <ItemStyle HorizontalAlign="Center" Width="25%" />
                </asp:BoundField>
            </Columns>
            <HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
            <PagerStyle CssClass="pagination" ForeColor="Black" HorizontalAlign="Center" />
            <SelectedRowStyle BackColor="#1E90FF" Font-Bold="True" ForeColor="White" />
            <SortedAscendingCellStyle BackColor="#F1F1F1" />
            <SortedAscendingHeaderStyle BackColor="#808080" />
            <SortedDescendingCellStyle BackColor="#CAC9C9" />
            <SortedDescendingHeaderStyle BackColor="#383838" />
        </asp:GridView>
        <br />
        <div class="legenda">
            <asp:Button ID="btnIncluir" runat="server" formnovalidate="formnovalidate" Text="Incluir"
                OnClick="btnIncluir_Click" Width="100px" />
        </div><br />
    </asp:Panel>
    <br />
    <asp:Panel ID="pnlEdicao" runat="server" GroupingText="Cadastro de Estados" Visible="False">
        <table class="form-inline">
            <tr>
                <td class="style2">
                    <asp:Label ID="Label2" runat="server" Text="Descrição"></asp:Label>
                    <br />
                    <asp:TextBox ID="TxtDescricao" required="required" title="Somente letras!"
                        pattern="[çÇùÙúÚôÔõÕòÒóÓìÌíÍêÊèÈéÉáÁàÀãÃâÂaA-zZ\s]+$" runat="server" 
                        MaxLength="2" Width="100px"></asp:TextBox>
                </td>
                <td>
                    <asp:Label ID="Label3" runat="server" Text="Situação"></asp:Label>
                    <br />
                    &nbsp;<asp:DropDownList ID="ddlSituacao" runat="server" Width="150px">
                        <asp:ListItem Value="A">Ativo</asp:ListItem>
                        <asp:ListItem Value="I">Inativo</asp:ListItem>
                    </asp:DropDownList>
                </td>
            </tr>
        </table>
        <br />
        <div class="legenda">
            <asp:Button ID="btnConfirmar" runat="server" Text="Confirmar" 
                OnClick="btnConfirmar_Click" Width="100px" />
            &nbsp;
            <asp:Button ID="btnCancelar" runat="server" formnovalidate="formnovalidate" Text="Cancelar"
                OnClick="btnCancelar_Click" Width="100px" />
        </div><br />
    </asp:Panel>
</asp:Content>
